package com.foreveredu.erlms.service;

import java.util.List;

import com.foreveredu.erlms.domain.Enroll;
import com.foreveredu.erlms.domain.Examinee;
import com.foreveredu.erlms.domain.Grade;
import com.foreveredu.erlms.domain.PageModel;
import com.foreveredu.erlms.domain.Parameter;
import com.foreveredu.erlms.domain.Rank;

public interface IExamService {

	/*
	 * Enroll对象的事务处理
	 */
	void saveEnroll(Enroll enroll);
	
	void deleteEnrollById(int id);
	
	void updateEnroll(Enroll enroll);
	
	List<Enroll> findEnrolls();
	
	Enroll findEnrollById(int id);
	
	//通过身份证号码和报名号查找报名信息
	Enroll findEnrollByIdCardAndEnrollNumber(String idCard, String enrollNumber);
	
	//获得本届考试的所有有效报名信息（已缴费并生成报名号），以便导出DBF格式的报名数据
	List<Enroll> findEnrollsByExamOrder(int examOrder);

	//获得本届考试中按班级排序的未交费学生报名信息，以便导出DBF格式的报名数据
	List<Enroll> findNoPaidEnrollsByExamOrder(int examOrder);
	
	PageModel findEnrollList(int offset , int examOrder);
	
	//获取未交费的学生信息列表
	PageModel findEnrollListByPaid(int offset,int examOrder);
	
	//获取未上传相片学生信息列表
	PageModel findEnrollListByIcon(int offset,int examOrder);
	
	List<Enroll> findEnrollByExamineeId(int id);
	
	List<Enroll> findEnrollByIdCard(String idCard, int examOrder);
	
	int findEnrollAllNumber(int examOrder);
	
	int findEnrollPaidNumber(int examOrder);
	
	int findEnrollKeepGradeNumber(int examOrder);
	
	int findEnrollPaidNumberByToday(String now);
	
	int findEnrollPaidNumberByTodayAndKeepGrade(String now);
	
	Boolean findEnrollByDeptAndIdCard(int examOrder, String idCard, int rankId);

//	List<Enroll> findEnrollByIdCardAndSerialNumber(String idCard, String serialNumber, int examOrder);
	
	/*
	 * Examinee对象的事务处理
	 */
	void saveExaminee(Examinee examinee);
	
	void deleteExamineeById(int id);
	
	void updateExaminee(Examinee examinee);
	
	List<Examinee> findExaminees();
	
	Examinee findExamineeById(int id);
	

	//获得本届考试中拥有当前报考等级的最大报名号
	String getMaxEnrollNumber(String schoolCode, String rankCode, int examOrder);

	//获得本届考试中的最大网报号
	String getMaxSerialNumber(String schoolCode, int examOrder);

	//通过网报号查找本届考试中的考生
	Examinee findExamineeBySerialNumber(String serialNumber, int examOrderOfNow);
	
	Examinee findExamineeByTicketNumber(String ticketNumber, int examOrderOfNow);
	
	List<Integer> findExamOrderByExaminee();
	
	Examinee findExamineeByIdCard(String idCard, int examOrder);
	
	/*
	 * Grade对象的事务处理
	 */
	void saveGrade(Grade grade);
	
	void deleteGradeById(int id);
	
	void updateGrade(Grade grade);
	
	List<Grade> findGrades();
	
	Grade findGradeById(int id);
	
	//通过身份证号码获得本届考试中的学生成绩
	Grade findGradeByIDCardAndTicketNumber(String idCard, String ticketNumber, int examOrder);
	
	PageModel findGradeList(int offset, int examOrder);
	
	int findGradeByDeptIdAndZcj(int deptId,int examOrder);
	
	int findGradeByDeptId(int deptId, int examOrder);
	
	/*
	 * Rank对象的事务处理
	 */
	void saveRank(Rank rank);
	
	void deleteRankById(int id);
	
	void updateRank(Rank rank);
	
	List<Rank> findRanks();
	
	Rank findRankById(int id);
	
	Rank findRankByCode(String code);

	//获得有效的报考等级列表
	List<Rank> findRanksOfEnabled();
	
	/*
	 * Parameter对象的事务处理
	 */
	void saveParameter(Parameter parameter);
	
	void deleteParameterById(int id);
	
	void updateParameter(Parameter parameter);
	
	List<Parameter> findParameters();
	
	Parameter findParameterById(int id);
	
	//获得学校代码
	String getSchoolCode();
	
	//获得当前考试的届次
	int getExamOrderOfNow();

	//获得当前系统参数对象
	Parameter getParameterOfNow();

	//在本次考试中根据身份证和报名号查找考生信息
	Enroll findEnrollByIdCardAndSerialNumber(String idCard, String serialNumber, int examOrder);

	Examinee findExamineeByEnrollNumber(String enrollNumber, int examOrderOfNow);

	Grade findGradeByExamineeId(int id);

	/*
	 * MaxSNRecord对象的事务处理
	 * 
	 */
	//获得当前最大的网报号
	String getMaxSNRecord();
	
	//获得当前最大的报名号
	String getMaxENRecord(String rankCode);

	//如果修改考试届次，则将MaxSNRecord表中记录的最大网报号和最大报名号置为1
	void clearMaxSNRecord();
}
